% 引入符号变量
syms C1 C2 R L t V1 V2 V3 V4 V5 integral_V2 integral_V3 integral_V4 integral_V5 x1 x2 x3 x4 x5 pi

% 定义系数矩阵 A
A = [
    C2/(C1 + C2), -1, C1/(C1 + C2), 0, 0;
    0, C1/(C1 + C2), -1, C2/(C1 + C2), 0;
    0, 0, C2/(C1 + C2), -1, C1/(C1 + C2);
    0, 0, 0, 1, -1;
    1, 0, 0, 0, 0
];

% 定义右侧向量 b
b = [
    (1 / (C1 + C2)) * ((V2 - V1) / R + (V2 - V3) / R + (1 / L) * integral_V2);
    (1 / (C1 + C2)) * ((V3 - V2) / R + (V3 - V4) / R + (1 / L) * integral_V3);
    (1 / (C1 + C2)) * ((V4 - V3) / R + (V4 - V5) / R + (1 / L) * integral_V4);
    (1 / C1) * ((V5 - V4) / R + (1 / L) * integral_V5);
    2 * pi * 89000 * cos(2 * pi * 89000 * t)  % 保留为符号形式
];

% 定义未知向量 x
x = [x1; x2; x3; x4; x5];

% 求解方程 A * x = b 的解析解
solution = simplify(A \ b);

% 显示结果
disp('x 的解析解为：');
disp(solution);

